@extends('layouts.admin')

@section('title','属性列表')

@section('content')
    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <form action="{{ route('admin.attribute.destroyAll') }}" method="post">
            {{csrf_field()}}
            <div class="box">
              <div class="box-header">
               <a href="{{ route('admin.attribute.create') }}">
               	<button type="button" class="btn bg-olive btn-flat margin">新增</button>
               </a>
               <button type="button" class="btn bg-maroon btn-flat margin btn-submit" type="submit" data-check="">删除</button>
              </div>
              <!-- /.box-header -->
              <div class="box-body">
                <table id="example2" class="table table-bordered table-hover">
                  <thead>
                  <tr>
                  	<th></th>
                  	<th>id</th>
                    	<th>属性名称</th>
                      <th>所属分类</th>
                    	<th>状态</th>
                    	<th>操作</th>
                  </tr>
                  </thead>
                  <tbody>
                  @foreach( $lists as $key => $value )
                  <tr>
                  	<td><input type="checkbox" name="attr_ids[]" value="{{ $value->id }}"></checkbox></td>
                    	<td>{{ $value->id }}</td>
                      <td>{{ $value->name }}</td>
                      <td>{{ $value->category->name }}</td>
                    	<td>
                        @if($value->status == 1)
                        <a href="{{ route('admin.attribute.unpublish', ['id'=>$value->id]) }}" class="ajax-get" data-success="reload">
                          <button type="button" class="btn btn-success">发布</button>
                        </a>du
                        @elseif($value->status == 0)
                        <a href="{{ route('admin.attribute.publish', ['id'=>$value->id]) }}" class="ajax-get" data-success="reload">
                          <button type="button" class="btn btn-warning">禁用</button>
                        </a>
                        @endif                        
                      </td>
                    	<td>
                        <a href="{{ route('admin.attribute.edit', ['id'=>$value->id]) }}">
  	                  	  <button type="button" class="btn btn-info">编辑</button>
                        </a>
                        <a href="{{ route('admin.attribute.destroy', ['id'=>$value->id]) }}" class="ajax-get">
  	                  	  <button type="button" class="btn btn-danger">删除</button>
                        </a>
                		</td>
                  </tr>
  				        @endforeach
                  </tbody>
                </table>
              </div>
            </div>
          </form>
        </div>
      </div>
    </section>
    <div class="paginate">{{ $lists->links() }}</div>
@stop